package com.yl.chainStore.services.pay

import com.yl.chainStore.common.enums.TypeEnum
import com.yl.chainStore.entity.pay.*
import com.yl.chainStore.entity.sick.SickCustomerAccessLog
import com.yl.chainStore.entity.sick.SickMedicalRecords
import com.yl.chainStore.pojo.vo.pay.*
import com.yl.common.control.ResponseBody
import com.yl.common.control.returnSuccess
import com.yl.users.entity.CompanyUser
import java.util.*

/**
 * @description :订单详情
 * @create :2021-06-25 10:33:00
 */
interface IPayCustomerOrderService {


	/**
	 *  提醒技加工物品已经到货
	 */
	fun goodsArrive(orderDetailId: Long): ResponseBody


	/**
	 * 获取订单参数
	 */
	fun getOrderInfo(orderId: Long): PayCustomerOrder?

	/**
	 * 订单明细
	 */
	fun getOrderDetails(orderId: Long):MutableList<PayCustomerOrderDetail>

	/**
	 * 单个订单明细
	 */
	fun getDetailById(detailId: Long):PayCustomerOrderDetail?

	/**
	 * 修改订单基本信息（就诊时间，备注   明细里面的医生，护士，咨询师，网店咨询师）
	 */
	fun updateOrderInfo(order: CustomerOrderUpdateVo):ResponseBody

	/**
	 * 修改订单应付款总额
	 * @param updateType 1411-1450 订单需付款金额修改类型
	 * @param originalPrice 全局修改金额  按百分比处理订单
	 * @param associatedId  关联id
	 * @param list			修改后的订单明细，
	 *
	 */
	fun updateOrderOriginalPrice(orderId: Long, originalPrice: Long?,updateType:TypeEnum,onlyOriginalPrice:Boolean
								 ,associatedId:Long,list: List<PayCustomerOrderDetail>?,
								 createUserId:Long?,
								 createTime:Date?,
								 amountMoney:Long?): ResponseBody

	/**
	 * 获取订单的连接内容（列表用）
	 */
	fun getOrderLeftJoinSet(order: PayCustomerOrder):ResponseBody

	/**
	 * id,User  Set没写什么用户是能对比相同的   (从订单明细里面获取)
	 */
	fun getOrderDoctors(orderId: Long):Map<Long,CompanyUser>

	fun getOrderDoctors(order: PayCustomerOrder): Map<Long, CompanyUser>

	/**
	 * 明细里面的医生，护士，咨询师，网电咨询师名称
	 */
	fun setOrderDetailUserName(order: PayCustomerOrder)

	/**
	 * 逗号隔开
	 */
	fun getOrderDoctorNameStr(orderId: Long):String?

	fun getOrderDoctorNameStr(order: PayCustomerOrder): String?

	/**
	 * id,User  Set没写什么用户是能对比相同的
	 */
	fun getOrderNurses(orderId: Long):Map<Long,CompanyUser>

	/**
	 * 逗号隔开
	 */
	fun getOrderNurseNameStr(orderId: Long):String?


	/**
	 * 添加一个明细
	 */
	fun addDetail(detail: PayCustomerOrderDetail): ResponseBody

	/**
	 * 清除订单明细
	 */
	fun delAllDetail(orderId: Long): ResponseBody

	/**
	 * 删除一个明细
	 */
	fun delDetail(detailId: Long): ResponseBody

	/**
	 * 获取订单明细列表
	 */
	fun getDetailList(orderId: Long): MutableList<PayCustomerOrderDetail>

	/**
	 * 保存订单vo转成order对象
	 * (单价金额相关处理问题)
	 */
	fun saveOrderVoToOrder(vo: PayCustomerOrderSaveVo):PayCustomerOrder

	/**
	 * 处理部分数据
	 * 1，计算一下，订单总额()
	 */
	 fun accountingPayCustomerOrder(order: PayCustomerOrder): ResponseBody

	/**
	 * 订单明细处理（补充明细的商品名，规格之类的）
	 */
	fun setOrderDetailItemInfo(order: PayCustomerOrder)

	/**
	 * 订单明细处理（补充明细的商品名，规格之类的）
	 */
	fun setOrderDetailItemInfo(list: List<PayCustomerOrderDetail>)

	/**
	 * 设置订单的退款相关
	 */
	fun setOrderRefund(order: PayCustomerOrder)

	/**
	 * 放入订单馈赠金额的
	 */
	fun setOrderGiftOfGoldPay(order: PayCustomerOrder)

	/**
	 * 设置订单的退款相关
	 */
	fun setOrderRefund(list: List<PayCustomerOrderDetail>)

	/**
	 * 修改订单信息
	 */
	fun updateOrder(
		orderId: Long,
		masterUserId: Long?,
		secondaryUserId: Long?,
		remark: String?,
		orderMaualSumMoney:Long?
	): ResponseBody

	/**
	 * 删除订单（未下单的）
	 */
	fun delOrder(orderId: Long):ResponseBody

	/**
	 * 删除订单（已经付款的）
	 */
	fun delOrderHasPay(orderId: Long):ResponseBody

	/**
	 * 订单优惠记录
	 */
	fun getCustomerOrderDiscountLogs(orderId: Long):MutableList<PayCustomerOrderDiscountLog>

	/**
	 * 订单项目优惠记录
	 */
	fun getCustomerOrderItemDiscountLogs(orderId: Long):MutableList<PayCustomerOrderItemDiscountRuleLog>

	/**
	 * 订单下的项目回访
	 */
	fun getCustomerOrderVisitLogList(order:PayCustomerOrder):MutableList<SickCustomerAccessLog>

	/**
	 * 退款记录
	 */
	fun getRefundLogList(orderId: Long):MutableList<PayOrderRefundLog>

	/**
	 * 退款记录明细
	 */
	fun getRefundLogDetailList(logId: Long):MutableList<PayOrderDetailRefundLog>


	/**
	 * 订单付款中（付了部分，后面还有欠款）
	 */
	fun setOrderToPaying(orderId: Long): ResponseBody

	/**
	 * 订单结束
	 */
	fun setOrderToEnd(orderId: Long): ResponseBody


	/**
	 * 获取就诊记录
	 */
	fun getCustomerMedicalRecord(orderId: Long): SickMedicalRecords?

	/**
	 * 获取订单下 公司收款记录
	 */
	fun getOrderCompanyCollectionLog(orderId: Long): List<PayCompanyCollectionLog>



	/**
	 * 绑定优惠卷
	 */
	fun bindCoupons(orderId: Long, couponsId: Long): ResponseBody

	/**
	 * 解除绑定优惠券
	 */
	fun unBindCoupons(orderId: Long, couponsId: Long?): ResponseBody

	/**
	 * 订单执行(付款)
	 * @param id 订单id
	 * @param paySumMoney 可以付的金额
	 */
	fun payOrder(id: Long,paySumMoney:Long,payLog: PayOrderCustomerPayLog): ResponseBody

	/**
	 * 获取订单的付款记录(包含明细)
	 */
	fun getOrderPayLogList(id:Long):List<PayOrderCustomerPayLog>

	/**
	 * 获取订单的付款记录明细
	 */
	fun getPayLogDetailList(logId: Long):List<PayOrderCustomerPayLogDetail>

	/**
	 * 修改付款记录的基础信息  时间，收款人之类的
	 */
	fun updateOrderPayLogInfo(vo:CustomerPayLogUpdateVo):ResponseBody

	/**
	 * 修改付款记录全部字段
	 */
	fun updateOrderPayLogAll(payLog: PayOrderCustomerPayLog):ResponseBody

	/**
	 * 付款记录返回打印对象
	 */
	fun payLogToPrint(logId:Long):List<PayOrderPrintShowVo>

	/**
	 * 付款记录返回打印对象
	 */
	fun payLogToPrint(payLog:PayOrderCustomerPayLog):List<PayOrderPrintShowVo>

	/**
	 * 订单 付款记录整合打印
	 */
	fun orderAllPayLogToPrint(id:Long):List<PayOrderPrintShowVo>


	/**
	 * 订单退款 (退到余额)
	 */
	fun refundOrder(vo: RefundByOrderVo):ResponseBody

	/**
	 * 添加项目优惠使用记录(会清除之前的记录)
	 */
	fun addPayCustomerOrderItemDiscountRuleLogs(list: List<PayCustomerOrderItemDiscountRuleLog>,orderId: Long): ResponseBody

	/**
	 * 添加订单优惠使用记录(会清除之前的记录)
	 */
	fun addPayCustomerOrderDiscountLog(list: List<PayCustomerOrderDiscountLog>,orderId: Long): ResponseBody

	/**
	 * 确认订单
	 */
	fun completeOrder(id:Long):ResponseBody

	/**
	 * 确认订单
	 */
	fun completeOrder(order:PayCustomerOrder):ResponseBody

	/**
	 * 通知订单，有明细完成后处理
	 */
	fun orderHaveDetailToEnd(id:Long):ResponseBody


	/**
	 * 设置订单明细完成(通知，尝试订单完成)
	 */
	fun setDetailToEnd(id: Long):ResponseBody

	/**
	 * 设置订单明细完成(通知，尝试订单完成)
	 */
	fun setDetailToEnd(detail: PayCustomerOrderDetail):ResponseBody

	/**
	 * 设置订单明细完成（不完成订单）
	 */
	fun onlySetDetailToEnd(detail: PayCustomerOrderDetail):ResponseBody

	/**
	 * 设置患者使用项目开始计算时间
	 *  关联显示用
	 */
	fun saveDetailUseStartTime(detailId: Long, startTime: Date): ResponseBody

	/**
	 * 设置患者使用项目开始计算时间
	 *  关联显示用
	 */
	fun saveDetailUseStartTime(detail: PayCustomerOrderDetail, startTime: Date): ResponseBody

}
